<div class="deal_content_top"></div>
<div align="center" style="background-color: white;">
	<form action="<?php echo $this->baseUrl("index.php/cms/solddeal") ?>" method="get">
		<table>
			<tr>
				<td><strong>Tìm kiếm</strong></td>
				<td>
					<input type="text" name="filter" value="<?php if(isset($this->filter)) echo $this->filter; ?>" />
				</td>
				<td>
					<input type="submit" value="Tìm" />
				</td>
			</tr>
		</table>
	</form>
</div>
<div class="deal_content_bottom" style="margin-bottom: 10px;"></div>

<div class="deal">	
	<div class="deal_content_top"></div>	
	<div class="deal_content sold_deals">		
		<?php if (count($this->paginator) != 0) { ?>
		<h3>Sản phẩm đã bán</h3>
		<?php foreach ($this->paginator as $deal): ?>
		<div class="sold_deal">
			<div class="sold_content">
				<a href="<?php echo $this->baseUrl('index.php/cms/index/deal/id/') . $deal->deal_id ?>"><?php echo $deal->deal_title ?></a>
			</div>
			<div class="sold_detail">
				<div class="sold_image"><img height="60px" width="90px" src="<?php echo $this->baseUrl('public/upload/images/deals/' . $deal->deal_avatar)?>" /></div>
				<div class="info">
					<div class="start"></div><strong>Bắt đầu: </strong><?php echo $deal->started ?><br />
					<div class="end"></div><strong>Kết thúc: </strong><?php echo $deal->deadline ?> <br />
					<div class="total"></div><strong>Số lượng mua: </strong><?php echo $deal->count_deal != null ? $deal->count_deal : 0 ?> người
				</div>
				<div class="prices">
					<span class="sold_text">Giá gốc</span>
					<span class="sold_price"><?php echo number_format($deal->value, 0, ".", ",") . 'đ' ?></span>
				</div>
				<div class="prices">
					<span class="sold_text">Giá bán</span>
					<span class="sold_price"><?php echo number_format($deal->product_price, 0, ".", ",") . 'đ' ?></span>
				</div>
				<div class="sold_off">
					<span class="price ">
						<?php
						$percent = (1 - ($deal->product_price / $deal->value))*100;
						echo number_format($percent, 0, ".", ","). '%';
						?>
					</span>
				</div>
			</div>
		</div>
		<?php endforeach ?>
		<div align="center"><?php echo $this->paginator; ?></div>
		<?php } ?>
	</div>
	<div class="deal_content_bottom"></div>
</div>